#ifndef SECONDWINDOW_H
#define SECONDWINDOW_H

#include <qpushbutton.h>
#include <qmainwindow.h>
#include <qlabel.h>
#include <qwidget.h>
#include <qtimer.h>
#include <stdlib.h>
#include <qstring.h>
#include "c_progrem/TCP_client.h"
#include "signal_class.h"
#include "c_progrem/TCP_client.h"
#include "c_progrem/UDP_client.h"
#include "warning.h"
#include "catch_audio.h"
#include "camara.h"

#define WIDTH  320 			//视频长宽
#define HEIGHT 240 			//视频长宽

#define SECWIN_TIME_OUT 10		//等待时间
#define TALKING_TIME_OUT 1000	//通话时间
#define LEAVE_MESSAGE_TIME_OUT 20	//留言时间
#define TIME 1000			//计时频率

extern char warning_buf[1024];
extern signalClass sig;
extern struct v4l2_buffer buf;
extern VideoBuffer *camara_buffers;
extern int camara_fd;

class SecondWindow: public QDialog
{
	Q_OBJECT
public:
	SecondWindow();
	~SecondWindow(void);

public slots:
	void button_press();
	void time_show();
	void SeconeWindow_reset_time();
	void secwin_close();
	
private:
	int hour, minute, second;
	int i;
	int dest_fd;
	int ret;
	int talking_time;//当前状态：'0'表示等待；‘1’表示通话；‘2’表示留言;'3'表示选择留言界面;
	char ip_buf[2048];
	FILE *fp;
	QString h, m, s, close_ip;
	QImage image;
	QTimer *time_qt, *timer;
	QPushButton *btn, *btn_acc, *btn_rej, *btn_finish;
	QLabel *time_lb, *show_self;  
	Warning *warning;
	void init();
	void time_init();
	void button_init();	
	void waiting_timeout();
	void talking_timeout();
	void leave_message_timeout();

private slots:
	void showMe();
	void camara_quit();;
	void leave_message();
	void rej_leave_message();
	void btn_finish_slot();
	    
signals:
	void quit_signal();
	void close_signal();
	void signal2show();
	void signal2hide();
};

#endif

